<?php

namespace App\Models\GameServer;

use Illuminate\Database\Eloquent\Model;

class RechargeRecord extends Model
{
    protected $table = 'user_pay_mall_buy_record';
    protected $primaryKey = 'id';
    protected $connection = 'game_server';

    public $timestamps = false;
    protected $fillable = [
        'account_id','account_name','price','jeton','gift_jeton','item_id','item_name','buy_time','note','total_jeton','distributer_id'
    ];

    //获取用户信息
    public function userInfo()
    {
        return $this->belongsTo('App\Models\GameServer\UserInfo', 'account_id', 'id');
    }

    //获取商品信息
    public function goods()
    {
        return $this->belongsTo('App\Models\GameServer\Goods', 'item_id', 'id');
    }

    public function getReasonAttribute()
    {
        return '充值'. $this->attributes['price'] . '元得' . $this->attributes['jeton'] . '筹码';
    }
}
